package com.example.demo.verify;

import com.example.demo.verify.validator.ParamValidValidator;

import javax.validation.Constraint;
import javax.validation.Payload;
import java.lang.annotation.*;

@Target({ElementType.FIELD, ElementType.PARAMETER})
@Retention(RetentionPolicy.RUNTIME)
@Repeatable(ParamValid.List.class)
@Constraint(validatedBy = ParamValidValidator.class)
public @interface ParamValid {
    String name() default "";
    int rule() default -1;
    int min() default -1;
    int max() default -1;
    String item() default "";
    String message() default "";
    boolean empty() default false;
    Class<?>[] groups() default {};
    Class<? extends Payload>[] payload() default {};

    @Target({ElementType.FIELD, ElementType.PARAMETER})
    @Retention(RetentionPolicy.RUNTIME)
    @Documented
    @interface List {
        ParamValid[] value();
    }
}
